<template>
  <div>
    <a-drawer
      width="35%"
      :title="formTitle"
      :label-col="4"
      :wrapper-col="14"
      :visible="open"
      :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }"
      @close="cancel"
    >
      <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
        <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
          <a-row :gutter="32" style="width: 60%; margin-left: 20%">
            <a-col :span="12">
              <a-form-model-item label="员工姓名" prop="yuangongName">
                <a-input
                  v-model="form.yuangongName"
                  placeholder="请输入员工姓名"
                  @focus="handleOpenUser"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="工资类型" prop="type">
                <a-select
                  placeholder="请选择工资类型"
                  v-model="form.type"
                  :getPopupContainer="
                    (triggerNode) => {
                      return triggerNode.parentNode || document.body;
                    }
                  "
                  style="width: 100%"
                  allow-clear
                >
                  <a-select-option
                    v-for="(d, index) in typeOptions"
                    :key="index"
                    :value="d.dictValue"
                    >{{ d.dictLabel }}</a-select-option
                  >
                </a-select>
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="底薪（元）" prop="basicSalary">
                <a-input-number
                  v-model="form.basicSalary"
                  :min="0"
                  style="width: 100%"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="提成(0.3即30%)" prop="draw">
                <a-input-number
                  v-model="form.draw"
                  :min="0"
                  style="width: 100%"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="分润比例(0.3即30%)" prop="fenrunBi">
                <a-input-number
                  v-model="form.fenrunBi"
                  :min="0"
                  style="width: 100%"
                />
              </a-form-model-item>
            </a-col>
            <a-col :span="12">
              <a-form-model-item label="计件单价（元）" prop="jijianAmount">
                <a-input-number
                  v-model="form.jijianAmount"
                  :min="0"
                  style="width: 100%"
                />
              </a-form-model-item>
            </a-col>

            <a-col :span="12">
              <a-form-model-item label="状态" prop="status">
                <a-radio-group v-model="form.status" button-style="solid">
                  <a-radio-button value="0"> 在职 </a-radio-button>
                  <a-radio-button value="1"> 离职 </a-radio-button>
                </a-radio-group>
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-spin>
        <div class="bottom-control">
          <a-space>
            <a-button @click="cancel"> 取消 </a-button>
            <a-button type="primary" @click="submitForm"> 保存 </a-button>
          </a-space>
        </div>
      </a-form-model>
    </a-drawer>
    <a-modal
      :visible="visible"
      title="选择员工"
      v-if="visible"
      width="65%"
      @ok="handleOk"
      @cancel="handleOk"
      :dialog-style="{ top: '10px' }"
      style="height: 60vh"
      :z-index="1002"
    >
      <change-user @getUser="handleManualShare" :isCheckBox="false" />
    </a-modal>
  </div>
</template>
<script>
import BizGongziSettingEditForm from "./BizGongziSettingForm";
export default {
  ...BizGongziSettingEditForm,
};
</script>
